<template>
<div>
  <h2>新增采购计划</h2>
  <el-form ref="form" :model="form" label-width="80px">
    <el-form-item label="商品类型">
      <el-input v-model="form.type"></el-input>
    </el-form-item>
    <el-form-item label="商品规格">
      <el-input v-model="form.specs"></el-input>
    </el-form-item>
    <el-form-item label="商品名称">
      <el-input v-model="form.name"></el-input>
    </el-form-item>
    <el-form-item label="采购数量">
      <el-input v-model="form.num"></el-input>
    </el-form-item>
    <el-form-item label="采购原因">
      <el-input type="textarea" v-model="form.reason"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">提交</el-button>
<!--      <el-button @click="resetForm('form')">重置</el-button>-->
    </el-form-item>
  </el-form>

</div>
</template>

<script>
export default {
  name: "AddBuyPlan",
data(){
    return{
      form: {
        type: '',
        specs: '',
        name: '',
        num: '',
        reason: '',
      }
    }
},
methods:{
  onSubmit() {
    // let that=this
    let fd=new FormData()
    fd.append("type",this.form.type)
    fd.append("specs",this.form.specs)
    fd.append("goodsName",this.form.name)
    fd.append("num",this.form.num)
    fd.append("reason",this.form.reason)

    this.$axios.post("/sscsys/buyplan/addPlan",fd).then(
        r=>{
         if(r.data=="ok"){
           this.$message.success("成功添加采购计划")
           this.$emit("UpdateDialogVisible",false)
         }else {
           this.$message.error("添加采购计划失败")
         }

        }
    )
  },

  // resetForm(form){
  //   this.$refs[form].resetFields();
  // },

}


}
</script>

<style scoped>

</style>